home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdlib.h>
- #include <proto/intuition.h>
- #include <intuition/intuition.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
- #include <graphics/text.h>
- #include <stdio.h>
-
- #ifndef GUINAME
- #include "test.h"
- #else
- #include GUINAME
- #endif
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct Library *GadToolsBase;
- struct Library *UtilityBase;
- struct Window *win;
- struct TextFont *font=NULL;
-
- void quit(char *e)
- {
- if(e) fprintf(stderr,"%s\n",e);
-
- if(font) CloseFont(font); /* Important !!! */
- if(win) CloseWindow(win);
- if(UtilityBase) CloseLibrary(UtilityBase);
- if(GadToolsBase) CloseLibrary(GadToolsBase);
- if(GfxBase) CloseLibrary((struct Library *)GfxBase);
- if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
-
- if(e) exit(EXIT_FAILURE);
- exit(EXIT_SUCCESS);
- }
-
- main()
- {
- struct IntuiMessage *msg;
- int run=1;
-
- if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",36)))
- quit("No intuition.library V36");
-
- if(!(GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",36)))
- quit("No graphics.library V36");
-
- if(!(GadToolsBase=OpenLibrary("gadtools.library",36)))
- quit("No gadtools.library V36");
-
- if(!(UtilityBase=OpenLibrary("utility.library",36)))
- quit("No utility.library V36");
-
- if(!(win=OpenWindowTags(NULL,
- WA_Left,160,WA_Top,20,
- WA_Width,320,WA_Height,200,
- WA_Title,TITLE,
- WA_IDCMP,BUTTONIDCMP|IDCMP_CLOSEWINDOW|SLIDERIDCMP|
- IDCMP_NEWSIZE|IDCMP_REFRESHWINDOW|IDCMP_SIZEVERIFY,
- WA_Flags,WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET
- |WFLG_SIMPLE_REFRESH
- |WFLG_CLOSEGADGET|WFLG_ACTIVATE,
- WA_MinWidth,0,WA_MinHeight,0,
- WA_MaxWidth,-1,WA_MaxHeight,-1,
- TAG_DONE ))) quit("Cannot open window");
-
- if(GG_SmartRenderGui(win,&TestPro,&font)) quit("Cannot render GUI");
-
- while(run) {
- WaitPort(win->UserPort);
- while(msg=GG_GetIMsg(win->UserPort)) {
- switch(msg->Class) {
- case IDCMP_CLOSEWINDOW: run--;
- break;
- case IDCMP_NEWSIZE: GG_ResizeGui(&TestPro);
- break;
- case IDCMP_SIZEVERIFY: GG_BeginResizeGui(&TestPro);
- break;
- case IDCMP_REFRESHWINDOW:
- GG_BeginRefresh(&TestPro);
- GG_RefreshGui(&TestPro);
- GG_EndRefresh(&TestPro,TRUE);
- break;
- case IDCMP_GADGETUP:
- break;
- }
- GG_ReplyIMsg(msg);
- }
- }
- GG_FreeGui(&TestPro);
-
- quit(NULL);
- }
-
-
-
-